package com.hkts.reportform.datastatics.controller;

import com.hkts.reportform.datastatics.entity.ReportForm;
import com.hkts.reportform.datastatics.service.GreenBodiesService;
import com.hkts.reportform.utils.ErpProperties;
import com.hkts.reportform.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 生坯库存实时数据
 */
@RestController
@RequestMapping("/greenBodies")
public class GreenBodiesController {

    @Autowired
    private RedisTemplate redisTemplate;

    //昨日
    @RequestMapping("/getGreenYesterDayData")
    public Map<String,Object> getGreenBodies()throws Exception{
        Map<String,Object> map=new HashMap<>();
        map.put(ErpProperties.GREEN_YESTER_DAY_NAME,redisTemplate.opsForList().range(ErpProperties.GREEN_YESTER_DAY_NAME,0,-1));
        map.put(ErpProperties.GREEN_YESTER_DAY,redisTemplate.opsForList().range(ErpProperties.GREEN_YESTER_DAY,0,-1));
        map.put(ErpProperties.GREEN_BEFORE_YESTER_DAY,redisTemplate.opsForList().range(ErpProperties.GREEN_BEFORE_YESTER_DAY,0,-1));
        return map;
    }
}
